/**
 * Created by wangdunwen on 2017/7/14.
 */
define([
  '../common/ReminderPanel'
], function (ReminderPanel) {
  let reminder = new ReminderPanel()

  let resetMap = function () {
    /*添加复位按钮的监听事件*/
    $('#mapReset').click(function () {
      let scene = viewer.scene
      let destination = scene.camera.getRectangleCameraCoordinates(Cesium.Camera.DEFAULT_VIEW_RECTANGLE)
      let mag = Cesium.Cartesian3.magnitude(destination)
      mag += mag * Cesium.Camera.DEFAULT_VIEW_FACTOR

      Cesium.Cartesian3.normalize(destination, destination)
      Cesium.Cartesian3.multiplyByScalar(destination, mag, destination)

      scene.camera.flyTo({
        destination: destination,
        orientation: {
          heading: 0.0,
          pitch: -Math.PI * 0.5,
          roll: 0.0
        },
        duration: 1.5,
        endTransform: Cesium.Matrix4.IDENTITY
      })

      viewer.scene.screenSpaceCameraController.enableZoom = true
      clearPlot()
      clearMeasureData()
      /*清除标绘事件*/
      destroyAllPlot()
      /*清除量测事件*/
      destroyAllMeasure()
      /*关闭当前提示框*/
      reminder.hide()
    })
  }

  return resetMap
})
